<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>患者列表</title>
    <include file="Common:header_include"/>
    <style>
        .red{
            color: red;
        }
    </style>
</head>
<body>
<!--头部开始-->
<include file="Common:index_include"/>
<!--头部结束-->
<div class="p_main">
    <div class="p_tab row">
        <div class="p_switch col-xs-2">
            <p>首页/患者列表</p>
            <ul class="p_ul">
                <volist name="column" id="v">
                    <li><a href="{:U('DoctorInfo/index',array('genre'=>2,'type'=>$v['id']))}" <if condition="$_REQUEST['type'] eq $v['id']">class="p_txt"</if>>{$v['title']}<b class="rt"></b></a></li>
                </volist>
                <li><a href="{:U('DoctorInfo/index',array('genre'=>2,'add'=>1))}" <if condition="$_REQUEST['add'] eq 1">class="p_txt"</if>>添加患者<b class="rt"></b></a></li>
            </ul>
        </div>
        <div class="p_cont col-xs-10">
            <p>
                <volist name="column" id="v">
                    <if condition="$_REQUEST['type'] eq $v['id']">
                        <span class="lf">{$v['title']}</span>
                    </if>
                </volist>
                <if condition="$_GET['add']">添加患者</if>
                <span class="rt"  <if condition="$_GET['add']">style="display:none" </if>> <input type="text"/><input type="submit"/></span>
            </p>
            <div class="p_cont_cage">
                <volist name="list" id="v">
                    <div class="">
                        <div class="p_change_box row">
                            <div  class="col-xs-2 prow_2"><img src="__HIMG__00b.jpg" alt=""/></div>
                            <div class="col-xs-7 prow_7">
                                <ul>
                                    <li><span>姓名:</span><a href="javascript:;">{$v['patientid']['realname']}</a></li>
                                    <li><span>性别:</span><a href="javascript:;"> <if condition="$v['sex'] eq 1" >男<else/>女</if></a></li>
                                    <li><span>年龄:</span><a href="javascript:;">{:birthday2($v['patientid']['birthday'])}</a></li>
                                    <li><span>备注:</span><a href="javascript:;">该患者血糖较高。糖尿病肾病是糖尿病常见的并发症,是糖尿病全身性微血管病变表现之一。</a></li>
                                </ul>
                            </div>
                                <div class="col-xs-3 prow_3">
                                    <ul class="p3_btn">
                                  <if condition="$_GET['type'] eq 1">
                                        <li><a href="javascript:;" onclick="decline({$v['patientid']['id']},22)">拒绝</a></li>
                                        <li><a href="javascript:;" onclick="decline({$v['patientid']['id']},2)">通过</a></li>
                                        <li class="p3_btn_ul">
                                            <a href="javascript:;">分配</a>
                                            <div>
                                                <span></span>
                                                <ul>
                                                    <li><a href="javascript:;" onclick="decline({$v['patientid']['id']},4)">特别关注</a></li>
                                                    <li><a href="javascript:;">设为共享病人</a></li>
                                                    <li><a href="javascript:;">分配</a></li>
                                                    <li><a type="button" class="btn"  data-toggle="modal"  id="test"   onclick="updates({$v['patientid']['id']})" data-target=".bs-example-modal-lg">终止随访</a></li>
                                                    <li><a href="javascript:;" onclick="decline({$v['patientid']['id']},3)">删除</a></li>
                                                </ul>
                                            </div>
                                        </li>
                                        <li><a href="{:U('chatview',array('patientid'=>$v['patientid']['id']))}" target="_blank">交流</a></li>
                                    <else/>
                                      <li class="p3_btn_ul">
                                          <a href="javascript:;">分配</a>
                                          <div>
                                              <span></span>
                                              <ul>
                                                  <li><a href="javascript:;" onclick="decline({$v['patientid']['id']},4)">特别关注</a></li>
                                                  <li><a href="javascript:;">设为共享病人</a></li>
                                                  <li><a href="javascript:;">分配</a></li>
                                                  <li><a type="button" class="btn"  data-toggle="modal"  id="test"   onclick="updates({$v['patientid']['id']})" data-target=".bs-example-modal-lg">终止随访</a></li>
                                                  <li><a href="javascript:;" onclick="decline({$v['patientid']['id']},3)">删除</a></li>
                                              </ul>
                                          </div>

                                      </li>
                                      <li><a href="{:U('chatview',array('patientid'=>$v['patientid']['id']))}" target="_blank">交流</a></li>
                                   </if>
                                    </ul>
                                </div>
                        </div>
                    </div>
                </volist>
                 <if condition="$_GET['type']"><div class="page">{$page}</div></if>
                <if condition="$_GET['add']">
                    <div class="p_change">
                        <form  id="death" >
                            <div class="row">
                                <div class="form-group col-xs-6">
                                    <label class="col-xs-3 control-label"><span class="red">*</span>患者姓名：</label>
                                    <div class="col-xs-7">
                                        <input type="text" class="form-control"  name="realname" autocomplete="off" placeholder="请输入患者姓名"  datatype="*" sucmsg="验证成功">
                                    </div>
                                    <div class="col-xs-2">

                                    </div>
                                </div>
                                <div class="form-group col-xs-6">
                                    <label class="col-xs-3 control-label"><span class="red">*</span>性别：</label>
                                    <div class="col-xs-7">
                                        <select class="select form-control" size="1" name="sex" datatype="*" sucmsg="验证成功">
                                                  <option value="">请选择</option>
                                                  <option value="0">女</option>
                                                <option value="1" >男</option>
                                         </select>
                                    </div>
                                    <div class="col-xs-2">
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="form-group col-xs-6">
                                    <label class="col-xs-3 control-label">出生日期：</label>
                                    <div class="col-xs-7">
                                        <input type="text" class="form-control"  name="birthday" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd HH:mm:ss' })" autocomplete="off" placeholder="请输入"  value="">
                                    </div>
                                </div>
                                <div class="form-group col-xs-6">
                                    <label class="col-xs-3 control-label">联系地址：</label>
                                    <div class="col-xs-7">
                                        <input type="text" class="form-control" autocomplete="off" placeholder="请输入" name="address">
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="form-group col-xs-6">
                                    <label class="col-xs-3 control-label"><span class="red">*</span>血型：</label>
                                    <div class="col-xs-7">
                                        <select class="select form-control" size="1" name="bloodid" datatype="*" sucmsg="验证成功" >
                                            <option value="" selected="" disabled="disabled">请选择</option>
                                            <volist name=":getLists(bloodtypeinfo)" id="v">
                                                <option value="{$v.id}">{$v.name}</option>
                                            </volist>
                                        </select>
                                    </div>
                                    <div class="col-xs-2">

                                    </div>
                                </div>
                                <?php $type=getLists(kidneysourcetype);?>
                                <div class="form-group col-xs-6">
                                    <label class="col-xs-3 control-label"><span class="red">*</span>器官来源：</label>
                                    <div class="col-xs-7">
                                        <select class="select form-control" size="1" name="sourceid" datatype="*" sucmsg="验证成功">
                                            <option value="" selected="" disabled="disabled">请选择</option>
                                            <volist name=":getLists(kidneysourcetype)" id="v">
                                                <option value="{$v.id}">{$v.name}</option>
                                            </volist>
                                        </select>
                                    </div>
                                    <div class="col-xs-2" >

                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="form-group col-xs-6">
                                    <label class="col-xs-3 control-label">患病时长：</label>
                                    <div class="col-xs-7">
                                        <input type="text" class="form-control" autocomplete="off" placeholder="请输入">
                                    </div>
                                </div>
                                <div class="form-group col-xs-6">
                                    <label class="col-xs-3 control-label"><span class="red">*</span>手术时间：</label>
                                    <div class="col-xs-7">
                                        <input type="text" class="form-control"  name="operationtime" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd HH:mm:ss' })" autocomplete="off" placeholder="请输入"  value="" datatype="*" sucmsg="验证成功">
                                    </div>
                                    <div class="col-xs-2" >

                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="form-group col-xs-6">
                                    <label class="col-xs-3 control-label"><span class="red">*</span>手术医院：</label>
                                    <div class="col-xs-7">
                                            <select class="select form-control" size="1" name="hospitalid" datatype="*" sucmsg="验证通过">
                                                <option value="" selected="" disabled="disabled">请选择</option>
                                                <volist name=":getLists(hospitalinfo)" id="v">
                                                    <option value="{$v.id}">{$v['name']}</option>
                                                </volist>
                                            </select>
                                    </div>
                                    <div class="col-xs-2">
                                    </div>
                                </div>
                                <div class="form-group col-xs-6">
                                    <label class="col-xs-3 control-label"><span class="red">*</span>同供体患者：</label>
                                    <div class="col-xs-7">
                                        <input type="text" class="form-control" autocomplete="off" placeholder="请输入" name="commonid" datatype="*" sucmsg="验证通过">
                                    </div>
                                    <div class="col-xs-2">
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <!--<div class="form-group col-xs-6">-->
                                    <!--<label class="col-xs-3 control-label">联系电话：</label>-->
                                    <!--<div class="col-xs-7">-->
                                        <!--<input type="text" class="form-control" autocomplete="off" placeholder="请输入" name="phone">-->
                                    <!--</div>-->
                                <!--</div>-->
                            </div>
                            <div class="row p_submit">
                                <div class="col-xs-offset-4 col-xs-2"> <input type="submit"  value="提交"/></div>
                                <div class="col-xs-offset-1 col-xs-2" id="matching"  style="display: none"><input type="button" onclick="showIframe('进行配型信息','{:U('Index/matching',array('id'=>$data['id']))}','1050','900')" value="进行配型信息"/></div>
                            </div>
                        </form>
                    </div>
                </if>
            </div>
        </div>
        <form id="fellowupStop">
            <div class="modal fade bs-example-modal-lg" tabindex="-1" id="fellow" role="dialog" aria-labelledby="myLargeModalLabel">
                <div class="modal-dialog modal-lg" role="document">
                    <div class="modal-content">
                        <div class="modal-header  z_tlt">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title text-center">终止随访</h4>
                        </div>
                        <input type="text" class="form-control" autocomplete="off" id="userid"  name="userid" placeholder="请输入" >
                        <div class="modal-body">
                            <form class="z_form" action="">
                                <div class="row">
                                    <div class="form-group col-xs-12">
                                        <label class="z_txt col-xs-offset-3 col-xs-3 control-label">选择终止随访原因：</label>
                                        <div class="col-xs-4">
                                            <select name="stoptypeid" id="stoptypeid">
                                                <option value="" selected="" disabled="disabled">请选择</option>
                                                <volist name=":getLists(fellowupstoptype)" id="v">
                                                    <option value="{$v.id}">{$v.name}</option>
                                                </volist>
                                            </select>
                                        </div>
                                        <div  class="col-xs-4">

                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="z_txt z_btm col-xs-offset-3 col-xs-3">自定义终止随访原因：</div>
                                </div>
                                <div class="row">
                                    <textarea class="col-xs-offset-3 col-xs-6" cols="20" name="description" rows="10" placeholder="请输入终止随访原因"></textarea>
                                </div>
                            </form>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-danger" data-dismiss="modal">取消</button>
                            <button type="button" class="btn btn-success"  onclick="fellowupStop()">确定</button>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>
</div>
</div>

<!--尾部开始-->
<include file="Common:footer_include"/>
<!--尾部结束-->
</body>
<script>
    $("#death").Validform({
        tiptype:2,
        callback:function () {
            $.ajax({
                url:"{:U('deathpatient')}",
                data:$('#death').serialize(),
                type:"Post",
                dataType:"json",
                success:function (data) {
                    if(data.status==1){
                        layer.msg(data.msg,{time: 1000}, function () {$("#matching").show();});
                    }else{
                        layer.msg(data.msg,{time: 1000});
                    }
                },
                error:function () {
                    layer.msg('登陆失败，请刷新页面尝试再一次登录');
                }
            });
            return false;
        }
    });
    function decline($patientid,$type) {
        if($type==22){
            var content="你确定要拒绝该患者吗？";
        }else if($type==2){
            content="你确定要接受该患者吗？";
        }else if ($type==4){
            content="你确定要将该患者设为特别关注吗？";
        }else if($type==3){
            content="你确定要删除该患者吗？";
        }
        layer.open({
              anim: 6,
              content:content ,
              btn: ['确定', '否'],
            yes: function(){
                $.ajax({
                    url:"{:U('DoctorInfo/revieweds')}",
                    data:{
                        patient:$patientid,
                        type:$type
                    },
                    type:"Post",
                    dataType:"json",
                    success:function (data) {
                        if(data.status==1){
                            layer.msg(data.msg,{time: 1000}, function () { window.location.reload();});
                        }else{
                            layer.msg('操作失败');
                        }
                    },
                    error:function (err) {
                        layer.msg('服务器异常，请稍后在操作！');

                    }
                })
            },
            cancel: function(){
                //右上角关闭回调
            }
        });
    }
    /**
     * 获取到患者id嵌入模态窗
     * @param $id
     */
     function updates($id) {
           $("#userid").val($id);
      }
    /**
     * 提交终止随访
     */
    function fellowupStop() {
        if($("#stoptypeid option:selected").val()){
            $.ajax({
                url:"{:U('fellowupStop')}",
                data:$('#fellowupStop').serialize(),
                type:"Post",
                dataType:"json",
                success:function (data) {
                    if(data.status==1){
                        layer.msg(data.msg,{time: 1000}, function () {
                            $('#fellow').modal('hide');
                            window.location.reload();
                        });
                    }else{
                        layer.msg(data.msg,{time: 1000});
                    }
                },
                error:function () {
                    layer.msg('登陆失败，请刷新页面尝试再一次登录');
                }
            });
          }else{
            layer.msg('请选择随访终止原因',{time:1000});
          }
        }
</script>
</html>